//
//  StatusBottomView.swift
//  sinaBlog
//
//  Created by tianxiangyang on 15/12/18.
//  Copyright (c) 2015年 itcast. All rights reserved.
//

import UIKit
import SnapKit
class StatusBottomView: UIView {
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }
    
    required init(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    //MARK:设置界面
    private func setupUI(){
        
        //添加子控件
        
        addSubview(retweetedBtn)
        addSubview(commentBtn)
        addSubview(likeBtn)
        
        
        //设置约束
        retweetedBtn.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(self.snp_left)
            make.top.equalTo(self.snp_top).offset(statusMargin)
            make.width.equalTo(ScreenWidth / 3)
        }
        commentBtn.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(retweetedBtn.snp_right)
            make.top.equalTo(retweetedBtn.snp_top)
            make.width.equalTo(retweetedBtn.snp_width)
        }
        likeBtn.snp_makeConstraints { (make) -> Void in
            make.right.equalTo(self.snp_right)
            make.top.equalTo(commentBtn.snp_top)
            make.width.equalTo(commentBtn.snp_width)
        }
        
        
        setSepratorLine()
        
    }
    
    //MARK:设置分割线
    
    private func setSepratorLine(){
        
        sepLine1.backgroundColor = UIColor.blackColor()
        sepLine2.backgroundColor = UIColor.blackColor()
        
        addSubview(sepLine1)
        addSubview(sepLine2)
        
        //设置约束
        
        
        sepLine1.snp_makeConstraints { (make) -> Void in
            make.width.equalTo(sepLineWidth)
            make.left.equalTo(retweetedBtn.snp_right)
            make.height.equalTo(self.snp_height).multipliedBy(0.6)
            make.centerY.equalTo(self.snp_centerY)
        }
        sepLine2.snp_makeConstraints { (make) -> Void in
            make.width.equalTo(sepLineWidth)
            make.left.equalTo(commentBtn.snp_right)
            make.height.equalTo(sepLine1.snp_height)
            make.top.equalTo(sepLine1)
        }
        
        
        
    }
    
    
    
    
    
    
    
    //MARK:懒加载子控件
    
    lazy var retweetedBtn:UIButton = UIButton(title: "转发", image_Name: "timeline_icon_retweet",titleColor:UIColor.blackColor(),fontSize:12)
    lazy var commentBtn:UIButton = UIButton(title: "评论", image_Name: "timeline_icon_comment",titleColor:UIColor.blackColor(),fontSize:12)
    lazy var likeBtn:UIButton = UIButton(title: "赞", image_Name: "timeline_icon_like",titleColor:UIColor.blackColor(),fontSize:12)
    
    //两条分割线
    lazy var sepLine1:UIView = UIView()
    lazy var sepLine2:UIView = UIView()
 
    
}
